<?php include "templates/include/header.php" ?>

      <div id="adminHeader">
        <h2>Administration des partenaires</h2>
        <p>Vous etes connect&eacute; en tant que <b><?php echo htmlspecialchars( $_SESSION['username']) ?></b>. <a href="admin.php?action=logout"?>Se D&eacute;connecter</a></p>
      </div>

      <h1><?php echo htmlspecialchars( $results['pageTitle'] )?></h1>

      <form action="admin.php?action=<?php echo $results['formAction']?>" method="post">
        <input type="hidden" name="matchId" value="<?php echo $results['edit']->id ?>"/>

<?php if ( isset( $results['errorMessage'] ) ) { ?>
        <div class="errorMessage"><?php echo $results['errorMessage'] ?></div>
<?php } ?>
  <table align="center" width="90%" cellpadding="5px" cellspacing="0" border="0">
    <?php
      if ( isset( $results['edit']->eventDate ) ) {
        $tmp = explode( " ", $results['edit']->eventDate );
	    $date = $tmp[0];
	    $time = $tmp[1];
	  }
    ?>
    <tr>
      <td valign="middle" style="margin:0;padding:0" align="left">
        <label for="date">Date :</label>
        <input id="date" name="date" placeholder="JJ/MM/AAAA" maxlength="255" value="<?php if ( isset( $date ) ) echo date( 'd/m/Y', strtotime( $date ) )?>"/>
      </td>
      <td>
        <label for="time">Horaire :</label>
        <input id="time" name="time" placeholder="hh:mm:ss" maxlength="255" value="<?php if ( isset( $time ) ) echo htmlspecialchars( $time )?>"/>
      </td>
      <td valign="middle" align="middle">
        <label for="location">Lieu :</label>
        <input name="location" id="location" placeholder="Lieu du match" maxlength="255" value="<?php echo htmlspecialchars( $results['edit']->location )?>"/>
      </td>
      <td valign="middle" align="middle">
        <label for="category">Cat&eacute;gorie :</label>
        <select id="category" name="category">
          <option value="seniora" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "seniora" ) { echo( 'selected="yes"' ); } } ?> >Senior A</option>
          <option value="seniorb" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "seniorb" ) { echo( 'selected="yes"' ); } } ?> >Senior B</option>
          <option value="u18" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u18" ) { echo( 'selected="yes"' ); } } ?> >U-18</option>
          <option value="u15" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u15" ) { echo( 'selected="yes"' ); } } ?> >U-15</option>
          <option value="u13" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u13" ) { echo( 'selected="yes"' ); } } ?> >U-13</option>
          <option value="u11" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u11" ) { echo( 'selected="yes"' ); } } ?> >U-11</option>
          <option value="u9" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u9" ) { echo( 'selected="yes"' ); } } ?> >U-9</option>
          <option value="u67" <?php if( isset( $results['edit']->id ) ) { if( $results['edit']->category == "u67" ) { echo( 'selected="yes"' ); } } ?> >U-6-7</option>
        </select>
      </td>
      <td valaign="middle" align="middle">
        <label for="descript">Description :</label>
        <textarea name="descript" id="descript" required maxlength="100000" style="height: 230px; width: 100%;">
          <?php
            if ( isset( $results['edit']->descript ) ) {
              echo( $results['edit']->descript );
            }
          ?>
        </textarea>
      </td>
    </tr>
  </table>
        <div class="buttons">
          <input type="submit" name="saveChanges" value="Enregister" />
          <input type="submit" formnovalidate name="cancel" value="Annuler" />
        </div>

      </form>

<?php if ( $results['edit']->id ) { ?>
      <p><a href="admin.php?action=deleteMatch&amp;matchId=<?php echo $results['edit']->id ?>" onclick="return confirm('Delete This Article?')">Supprimer cet Article</a></p>
<?php } ?>

<?php include "templates/include/footer.php" ?>
